package com.yy.mapper;

import com.yy.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user(openid,name,create_time) values (#{openid},#{name},#{createTime})")
    void insert(User user);

    @Select("Select * from user where id = #{currentId}")
    User selectById(Long currentId);
}
